package com.cloudfunx.common.aop.output;

import lombok.extern.slf4j.Slf4j;

import java.util.Objects;

/**
 * @author linjiayu
 */
@Slf4j
public class OutputFactory {
    private static OutputFactory OUTPUT_GLOBAL = null;
    private OutputParamInfoHandler outputParamInfoHandler = null;
    // private OutputJdbc outputJdbc;

    private OutputFactory() {

    }

    private OutputFactory(OutputParamInfoHandler handler) {
        outputParamInfoHandler = handler;
    }

    public static OutputFactory ins(OutputParamInfoHandler handler) {
        if (Objects.isNull(handler)) {
            return null;
        }
        OUTPUT_GLOBAL = new OutputFactory(handler);
        return OUTPUT_GLOBAL;
    }

    public static OutputFactory get() {
        return OUTPUT_GLOBAL;
    }

    public static String outputTable() {
        return "";
    }


    public void callback(OutputParamInfo paramInfo) {
        if (Objects.nonNull(outputParamInfoHandler)) {
            outputParamInfoHandler.afterAround(paramInfo);
        }
    }
}
